package com.pzh.logistics.service.impl;


import com.pzh.logistics.mbg.mapper.CollectionMapper;
import com.pzh.logistics.mbg.mapper.CourierMapper;
import com.pzh.logistics.mbg.mapper.TransitOrderMapper;
import com.pzh.logistics.mbg.model.TransitOrder;
import com.pzh.logistics.service.CourierService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CourierServiceImpl implements CourierService {

    @Resource
    private CourierMapper courierMapper;

    @Resource
    private CollectionMapper collectionMapper;

    @Resource
    private TransitOrderMapper transitOrderMapper;

    @Override
    public List<TransitOrder> listByState(Integer courierId, Integer state) {
        List<Integer> orderIdList = collectionMapper.selectByCourierIdAndIsCollect(courierId, state);
        if (orderIdList!=null && orderIdList.size() != 0){
            List<TransitOrder> orderList = transitOrderMapper.selectByPrimaryKeyList(orderIdList);
            return orderList;
        }
        return null;
    }
}